package cate.game.server.cli.mock;

import cate.game.client.msg.MsgOutput;
import cate.game.server.cli.MsgEncode;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame;
import io.netty.handler.codec.http.websocketx.WebSocketFrame;

public interface MockMsgOutput extends MsgOutput {

    default WebSocketFrame encode() {
        return MsgEncode.encode(this);
    }

    default void sendNow(ChannelHandlerContext ctx) {
        ctx.writeAndFlush(encode());
    }
}
